home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / defaultSpotLight.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.7 KB  |  90 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Procedure Name:
  19. //      defaultSpotLight
  20. //
  21. //  Description:
  22. //        create a default spot light
  23. //
  24. //  Input Arguments:
  25. //      None.
  26. //
  27. //  Return Value:
  28. //      None.
  29. //
  30. global proc defaultSpotLight(
  31.     float $intensity,
  32.     float $colourR,
  33.     float $colourG,
  34.     float $colourB,
  35.     int   $decay,
  36.     float $coneAngle,
  37.     float $dropOff,
  38.     float $penumbra,
  39.     int   $shadows,
  40.     float $shadowColourR,
  41.     float $shadowColourG,
  42.     float $shadowColourB,
  43.     int   $shadowSamples
  44. )
  45. {
  46.     string $lightName = `shadingNode -asLight spotLight`;
  47.     
  48.     // setOptionVars(false);
  49.  
  50.     string $cmd = ("setAttr " + $lightName + ".intensity " + `optionVar -query spotLightIntensity`);
  51.     eval $cmd;
  52.     
  53.     float $rgb[3] = `optionVar -query spotLightColor`;
  54.     $cmd = ("setAttr " + $lightName + ".colorR " + $rgb[0]);
  55.     eval $cmd;
  56.     $cmd = ("setAttr " + $lightName + ".colorG " + $rgb[1]);
  57.     eval $cmd;
  58.     $cmd = ("setAttr " + $lightName + ".colorB " + $rgb[2]);
  59.     eval $cmd;
  60.  
  61.     // cant do exclusive, not in spotLight command!!!!!
  62.  
  63.     $cmd = ("setAttr " + $lightName + ".decayRate " + `optionVar -query spotLightDecay`);
  64.     eval $cmd;
  65.  
  66.     $cmd = ("setAttr " + $lightName + ".coneAngle " + `optionVar -query spotLightConeAngle`);
  67.     eval $cmd;
  68.  
  69.     $cmd = ("setAttr " + $lightName + ".dropoff " + `optionVar -query spotLightDropoff`);
  70.     eval $cmd;
  71.  
  72.     $cmd = ("setAttr " + $lightName + ".penumbraAngle " + `optionVar -query spotLightPenumbra`);
  73.     eval $cmd;
  74.  
  75.     $cmd = ("setAttr " + $lightName + ".useDepthMapShadows " + `optionVar -query spotLightShadows`);
  76.     eval $cmd;
  77.  
  78.     $rgb = `optionVar -query spotLightShadowColor`;
  79.     $cmd = ("setAttr " + $lightName + ".shadColorR " + $rgb[0]);
  80.     eval $cmd;
  81.     $cmd = ("setAttr " + $lightName + ".shadColorG " + $rgb[1]);
  82.     eval $cmd;
  83.     $cmd = ("setAttr " + $lightName + ".shadColorB " + $rgb[2]);
  84.     eval $cmd;
  85.  
  86.     select -r $lightName;
  87.  
  88.     objectMoveCommand;
  89. }
  90.